@extends('adminer.admin')
@section("style")
    <style>
        .btn{ padding: 3px 12px;}
        .btn-warning {float: right; position: relative; top:4px; right:10px;}
    </style>
@endsection
@section('content')
    <!-- BEGIN PAGE HEADER-->
    @include("adminer.public.bread")
    <!-- END PAGE HEADER-->
    <!-- BEGIN PAGE CONTENT-->
    <div class="row-fluid">
        <div class="span12">
            <!-- BEGIN SAMPLE TABLE widget-->
            <div class="widget">
                <div class="widget-title">
                    <h4><i class="icon-reorder"></i>{{$title}}</h4>
                </div>
                <div class="widget-body" style="overflow: hidden">
                    <table class="table table-striped table-hover">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>用户ID</th>
                            <th>用户名</th>
                            <th>操作URL</th>
                            <th>备注</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach($list as $info)
                            <tr>
                                <td>{{$info->id}}</td>
                                <td>{{$info->user_id}}</td>
                                <td>{{$info->userInfo->username}}</td>
                                <td>{{$info->url}}</td>
                                <td>{{$info->remark}}</td>
                                <td></td>
                                <td><a href="javascript:;" onclick="show_info({{$info->id}});" title="查看"><i class="icon-eye-open"></i></a></td>
                            </tr>
                        @endforeach
                        </tbody>
                    </table>
                    <div class="pagination" style="float:right;">
                        {{$list->appends(['keyword'=>session('keyword')])->render()}}
                    </div>
                </div>
            </div>
            <!-- END SAMPLE TABLE widget-->
        </div>
    </div>
    <!-- END PAGE CONTENT-->
@endsection
@section("script")
    <script>
        jQuery(document).ready(function() {
            // initiate layout and plugins
            App.init();
        });
        function show_info(id){
            var html = "";
            $.get('/manage/adminlog/'+id,function(data){
                if(data.code == 200){
                    //var newHtml = '';
                    //var json = eval(data.data);
                    console.log(eval(data.data));
                    // for(var info in data.data){
                    //     console.log(data.data[info]);
                    //     newHtml += '<tr> \n' +
                    //         '    <td><span class="label label-success">'+info[0]+'</span></td>\n' +
                    //         '   <td>'+info[1]+'</td>\n' +
                    //         '</tr>';
                    // }
// console.log(newHtml);
//                     html = '<div class="widget-body"> \n' +
//                         '  <table class="table table-striped table-hover"> \n' +
//                         '     <tbody>'+newHtml+'</tbody> \n' +
//                         '   </table> \n' +
//                         '</div>';
//                     layer.open({
//                         title:"详情",
//                         type: 1,
//                         skin: 'layui-layer-rim', //加上边框
//                         area: ['450px', '260px'], //宽高
//                         content: html
//                     });
                }else{
                    layer.alert(data.message);
                }

            })

        }
    </script>
@endsection